package com.leador.http.callback;

import com.leador.http.ResultParse;
import com.leador.manger.LBSTraceClient;
import com.leador.module.response.Result;
import com.leador.module.response.entity.EntityCloumnResult;
import com.leador.module.response.entity.EntityResult;

/**
 * Created by lhy on 2016/9/18.
 */
public class EnitiyCallback {
    public static void entityCallBack(int status,String msg){
        if(LBSTraceClient.onEntityListener == null){
            return;
        }
        Result result = null;
        switch (status){
            case 0:
                result = ResultParse.resultParse(msg);
                LBSTraceClient.onEntityListener.onRequestFailedCallback(result);
                break;
            case 1:
                result = ResultParse.resultParse(msg);
                LBSTraceClient.onEntityListener.onAddEntityCallback(result);
                break;
            case 2:
                result = ResultParse.resultParse(msg);
                LBSTraceClient.onEntityListener.onUpdateEntityCallback(result);
                break;
            case 3:
                result = ResultParse.resultParse(msg);
                LBSTraceClient.onEntityListener.onDeleteCallback(result);
                break;
            case 4:
                EntityResult entityResult =ResultParse.entityListParse(msg);
                LBSTraceClient.onEntityListener.onListEntityCallback(entityResult);
                break;
            case 5:
                result = ResultParse.resultParse(msg);
                LBSTraceClient.onEntityListener.onAddEntityColumn(result);
                break;
            case 6:
                EntityCloumnResult entityCloumnResult = ResultParse.entityCloumnListParse(msg);
                LBSTraceClient.onEntityListener.onQueryEntityColumn(entityCloumnResult);
                break;
            case 7:
                 result = ResultParse.resultParse(msg);
                LBSTraceClient.onEntityListener.onDeleteEntityColumn(result);
                break;
        }
    }
}
